package com.controller;

import com.common.AjaxResult;
import com.SdkService.StreamService.SMS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class EHomeController {


    @Autowired
    private SMS sms;
    /**
     * 根据摄像头编号开始推流
     */
    @PostMapping("startPushStream/{CameraId}")
    public AjaxResult startPushStream(@PathVariable("CameraId") Integer CameraId){
        //设置ISUP取流参数

         if(!SMS.SMSListenerFlag){
            sms.SMS_StartListen();
         }

         sms.RealPlay(0);
         return AjaxResult.success();
    }

    /**
     * 根据摄像头编号停止推流
     */
    @PostMapping(value ="/stopPushStream/{CameraId}")
    public AjaxResult stopPreviewDevice(@PathVariable("CameraId") Integer CameraId)
    {
        sms.StopRealPlay(0);
        return AjaxResult.success();
    }

}
